package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("users")
public class UsersController {

    //@RequestMapping(value = "login",method = RequestMethod.GET)
    //用户登录
    @GetMapping("login")
    public String login(){
        System.out.println("执行用户登录...");
        return "login";
    }

    //@RequestMapping(value = "reg",method = RequestMethod.POST)
    @PostMapping("reg")
    public String reg(){
        System.out.println("执行用户注册...");
        return "reg";
    }

    //用户注销，接受GET和POST请求
    @RequestMapping(value="logout",method ={RequestMethod.GET,RequestMethod.POST})
    public String logout(){
        System.out.println("执行用户注销...");
        //返回/WEB-INF/jsp/logout.jsp
        return "logout";
    }
}
